﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Quan_Ly_Phong_Kham_co_len_em
{
    public partial class frmdonvitinh : Form
    {
        public frmdonvitinh()
        {
            InitializeComponent();


            TV_Tonghop.Themcot("MA_DVT", "Mã Đơn Vị", dt_tinh, DataGridViewAutoSizeColumnMode.Fill);
            TV_Tonghop.Themcot("DON_VI_TINH", " Đơn vị", dt_tinh, DataGridViewAutoSizeColumnMode.Fill);

        }
        public SqlConnection getconnect()
        {
            return new SqlConnection("Data Source=NGUYENTY-PC\\SQLEXPRESS;Initial Catalog=QL_PHONGKHAM;Integrated Security=True");

        }
        private void frmdonvitinh_Load(object sender, EventArgs e)
        {
            SqlConnection ketnoi = getconnect();
            SqlDataAdapter ad = new SqlDataAdapter("Select * from Don_Vi_Tinh", ketnoi); //ket noi den co so du lieu de goi ham da khai bao trong StoredProcedure
            DataTable dt = new DataTable();
            ad.Fill(dt);
            dt_tinh.DataSource = dt;
        }
    }
}
